home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java for 3D & VRML Worlds
/
Java for 3d and VRML Worlds.iso
/
examples
/
chap04
/
FollowingAgent.wrl
< prev
next >
Wrap
Text File
|
1996-10-14
|
854b
|
46 lines
#VRML V2.0 utf8
#
# an agent is always following you.
#
# initial viewpoint
Viewpoint{
position 0 2 0
}
DEF PROX_SENSOR ProximitySensor{
# you are always in the sensor field.
size 100 100 100
}
# floor
Transform{
translation 0 -0.5 0
children[
Shape{geometry Box{size 100 0.1 100}}
]
}
# stable object to make you realize the world coordinate.
Shape{geometry Box{}}
# following agent
DEF AGENT Transform{
children[
Inline{url "ManDetailed.wrl"}
]
}
DEF PROX_SCRIPT Script{
url "FollowingAgent.class"
eventIn SFVec3f currentPosition
eventOut SFVec3f setAgentPosition
}
ROUTE PROX_SENSOR.position_changed TO PROX_SCRIPT.currentPosition
ROUTE PROX_SCRIPT.setAgentPosition TO AGENT.set_translation